<!--学生个人详情信息组件-->
<template>
  <div>
    <table>
      <tr>
        <td>姓名</td>
        <td>{{student.name}}</td>
        <td>性别</td>
        <td>{{student.sex==1?'男':'女'}}</td>
      </tr>
      <tr>
        <td>学历</td>
        <td>{{student.education}}</td>
        <td>毕业时间</td>
        <td>{{student.graduateDate}}</td>
      </tr>
      <tr>
        <td>手机号码</td>
        <td>{{student.phone}}</td>
        <td>毕业院校</td>
        <td>{{student.college}}</td>
      </tr>
    </table>
    <table style="margin-top: 10px;">
      <tr>
        <td>工作状态</td>
        <td>{{resume.jobStatus}}</td>
      </tr>
      <tr>
        <td>自我评价</td>
        <td>{{resume.evaluate}}</td>
      </tr>
      <tr>
        <td>技能描述</td>
        <td>{{resume.skill}}</td>
      </tr>
    </table>
    <p v-if="projects.length>0">项目经验</p>
    <table v-for="(item,index) in projects" :key="index" style="margin-top: 10px">
      <tr>
        <td>项目名称{{index+1}}</td>
        <td>{{item.name}}</td>
      </tr>
      <tr>
        <td>描述</td>
        <td>{{item.description}}</td>
      </tr>
      <tr>
        <td>起止日期</td>
        <td>{{item.startDate}}至{{item.endDate}}</td>
      </tr>
    </table>
    <p v-if="trains.length>0">培训经历</p>
    <table v-for="(item,index) in trains" :key="index" style="margin-top: 10px">
      <tr>
        <td>培训课程{{index+1}}</td>
        <td>{{item.course}}</td>
      </tr>
      <tr>
        <td>培训公司</td>
        <td>{{item.company}}</td>
      </tr>
      <tr>
        <td>起止日期</td>
        <td>{{item.startDate}}至{{item.endDate}}</td>
      </tr>
    </table>
    <p v-if="intentions.length>0">求职意向</p>
    <table v-for="(item,index) in intentions" :key="index" style="margin-top: 10px">
      <tr>
        <td>职位名称{{index+1}}</td>
        <td>{{item.name}}</td>
        <td>薪资要求</td>
        <td>{{item.salary}}</td>
      </tr>
      <tr>
        <td>工作城市</td>
        <td>{{item.city}}</td>
        <td>工作类型</td>
        <td>{{item.type}}</td>
      </tr>
      <tr>
        <td>工作行业</td>
        <td colspan="3">{{item.industry}}</td>
      </tr>
    </table>

    <p v-if="certificates.length>0">获得荣誉</p>
    <table v-for="(item,index) in certificates" :key="index" style="margin-top: 10px">
      <tr>
        <td>证书名称{{index+1}}</td>
        <td>{{item.name}}</td>
      </tr>
      <tr>
        <td>获得时间</td>
        <td>{{item.obtainDate}}</td>
      </tr>
      <tr>
        <td>附件</td>
        <td>
          <img style="width: 100px;height: 100px;" v-if="item.file != null" :src="item.file">
          <span v-else>暂无上传</span>
        </td>
      </tr>
    </table>

    <p v-if="experiences.length>0">工作经历</p>
    <table v-for="(item,index) in experiences" :key="index" style="margin-top: 10px">
      <tr>
        <td>所在公司{{index+1}}</td>
        <td>{{item.company}}</td>
        <td>职位</td>
        <td>{{item.post}}</td>
      </tr>
      <tr>
        <td>薪资</td>
        <td>{{item.salary}}</td>
        <td>起止日期</td>
        <td>{{item.joinDate}}-{{item.leaveDate}}</td>
      </tr>
      <tr>
        <td>职位描述</td>
        <td colspan="3">{{item.description}}</td>
      </tr>
    </table>

  </div>
</template>

<script>
  import {detail as resume_detail} from "../api/resume";
  import {detail as student_detail} from "../api/student";
  import {query as train_detail} from "../api/train";
  import {query as certificate_detail} from "../api/certificate";
  import {query as project_detail} from "../api/project";
  import {query as intention_detail} from "../api/intention";
  import {query as experience_detail} from "../api/experience";

  export default {
    name: "ResumeDetail",
    props:['id'],
    data(){
      return{
        resume:{},
        student:{},
        trains:[],
        certificates:[],
        projects:[],
        intentions:[],
        experiences:[],
      }
    },
    mounted() {
      this.resume1();
    },
    methods:{
      resume1(){
        resume_detail(this.id).then(res=>{
          this.resume = res.data;
          this.student1(this.resume.studentId);
        })
      },
      intention1(){
        intention_detail({resumeId:this.id,studentId:this.student.id}).then(res=>{
          this.intentions = res.data;
        })
      },
      student1(studentId){
        student_detail(studentId).then(res=>{
          this.student = res.data;
          this.train1();
          this.certificate1();
          this.project1();
          this.intention1();
          this.experience1();
        })
      },
      train1(){
        train_detail({resumeId:this.id,studentId:this.student.id}).then(res=>{
          this.trains = res.data;
        })
      },
      certificate1(){
        certificate_detail({resumeId:this.id,studentId:this.student.id}).then(res=>{
          this.certificates = res.data;
        })
      },
      project1(){
        project_detail({resumeId:this.id,studentId:this.student.id}).then(res=>{
          this.projects = res.data;
        })
      },
      experience1(){
        experience_detail({resumeId:this.id,studentId:this.student.id}).then(res=>{
          this.experiences = res.data;
        })
      }
    }
  }
</script>

<style scoped>
  table
  {
    border-collapse: collapse;
    margin: 0 auto;
    text-align: center;
    width: 98%;
  }
  table td, table th
  {
    border: 1px solid #dddddd;
    color: #666;
    font-size: 14px;
    padding: 7px 0px;
  }
  table td:nth-child(odd){
    background-color: #f0f0f0;
    width: 90px;
  }
  table td:nth-child(even){
    text-align: left;
    padding-left: 10px;
  }
  p{
    margin: 10px 0px;
    padding: 0 20px;
    font-size: 14px;
  }
</style>